import xlrd

class  file_option:
    def __init__(self,filename):
        self.fname = filename

    def write_file(self,content):
        with open(self.fname, 'w') as f:
            f.write(content)

    def read_file(self):
        with open(self.fname, 'r') as f:
            list1 = f.readlines()


class excle_option:
    def __init__(self,filename):
        self.fname = filename
        pass







rfile = 'E:/日常资料/工作需求文档/XU/XU1.0系统测试用例-vmware.xls'

workbook = xlrd.open_workbook(rfile)
SheetList = workbook.sheet_names()
print(SheetList)

SheetName = SheetList[1]
print(SheetName)
# 电子表索引从0开始
Sheet1 = workbook.sheet_by_index(1)
# 实例化待女子表对象
Sheet1 = workbook.sheet_by_name(SheetName)
# 总用例数统计
total_num = 0


fail_count = 0
block_count = 0
pass_count = 0
notTest_count = 0
notAcpt_count = 0
wfile = 'E:/日常资料/工作需求文档/XU/XU1.0系统测试用例-vmware.txt'
fp = file_option(filename=wfile)

for i in range(Sheet1.nrows):
    rows = Sheet1.row_values(i)
    print(rows[8])
    if rows[8] == 'FAIL':
        fail_count += 1
        total_num += 1
    elif rows[8] =='BLOCK':
        block_count += 1
        total_num += 1
    elif rows[8] =='PASS':
        pass_count += 1
        total_num += 1
    elif rows[8] == 'NOT TEST':
        notTest_count += 1
        total_num += 1
    elif rows[8] == 'NOT ACCESS':
        notAcpt_count += 1
        total_num += 1
    # print(rows)
    # fp.write_file(rows)

print('Total %s Fail %s Block %s Pass %s NOT_TEST %s NOT_ACCESS %s' %(total_num,fail_count, block_count, pass_count,notTest_count,notAcpt_count))

